﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using System.Diagnostics;
using System.Threading;

namespace GameServer
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            //Make sure only one instance of server.
            bool bSingleServer;

            Mutex hOneServer = new Mutex(true, "GameServer", out bSingleServer);

            if (!bSingleServer)
            {
                MessageBox.Show("Server already running");
                return;
            }
            
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new MainForm());

            hOneServer.ReleaseMutex();
        }
    }
}
